package wiiusej.apptest.statistics;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;

import wiiusej.motionAlgorithms.CentroidsEnum;

public class AccelerationPaquet {

	private final long packetID;
	private Timestamp time, lastTime;	
	
	private int counter;
	
	private double xMean, yMean, zMean;
	private double xVar, yVar, zVar;
	
	private double distToCenter = 0;
	private CentroidsEnum currentCenter = null;
	
	private Vector<Integer> accX = new Vector<Integer>();
	private Vector<Integer> accY = new Vector<Integer>();
	private Vector<Integer> accZ = new Vector<Integer>();
	
	
	public AccelerationPaquet(Timestamp time, long packetID){
		this.counter = 0;
		this.packetID = packetID;
		this.time = time;		
	}
	
	
	
	
	public Timestamp getLastTime() {
		return lastTime;
	}




	public void setLastTime(Timestamp lastTime) {
		this.lastTime = lastTime;
	}




	public long getPacketID() {
		return packetID;
	}


	public double getDistToCenter() {
		return distToCenter;
	}


	public int uploadCounter(){
		return counter++;
	}


	public Timestamp getTime() {
		return time;
	}


	public void setTime(Timestamp time) {
		this.time = time;
	}


	public int getCounter() {
		return counter;
	}


	public void setCounter(int counter) {
		this.counter = counter;
	}


	public Vector<Integer> getAccX() {
		return accX;
	}


	public void setAccX(Vector<Integer> accX) {
		this.accX = accX;
	}
	
	public void addAccX(int accX){
		this.accX.add(accX);
	}


	public Vector<Integer> getAccY() {
		return accY;
	}


	public void setAccY(Vector<Integer> accY) {
		this.accY = accY;
	}
	
	public void addAccY(int accY){
		this.accY.add(accY);
	}


	public Vector<Integer> getAccZ() {
		return accZ;
	}


	public void setAccZ(Vector<Integer> accZ) {
		this.accZ = accZ;
	}
	
	public void addAccZ(int accZ){
		this.accZ.add(accZ);
	}
	
	@Override
	public String toString(){		
		return "[" + accX.lastElement() + "," + accY.lastElement() + "," + accZ.lastElement() + "]";
	}
	
	public String printFullList(){
		return accZ.toString();
	}
	
	public String printTimeStamp(){		
		
		SimpleDateFormat tsFormat = new SimpleDateFormat("mm:ss:SS");
		return "[Time: " + tsFormat.format(getTime()) + " Packets: " + getCounter() + "]";
	}


	public double getxMean() {
		return xMean;
	}


	public void setxMean(double xMean) {
		this.xMean = xMean;
	}


	public double getyMean() {
		return yMean;
	}


	public void setyMean(double yMean) {
		this.yMean = yMean;
	}


	public double getzMean() {
		return zMean;
	}


	public void setzMean(double zMean) {
		this.zMean = zMean;
	}


	public double getxVar() {
		return xVar;
	}


	public void setxVar(double xVar) {
		this.xVar = xVar;
	}


	public double getyVar() {
		return yVar;
	}


	public void setyVar(double yVar) {
		this.yVar = yVar;
	}


	public double getzVar() {
		return zVar;
	}


	public void setzVar(double zVar) {
		this.zVar = zVar;
	}
	
	
	public void setMeans(double xMean, double yMean, double zMean){
		this.xMean = xMean;
		this.yMean = yMean;
		this.zMean = zMean;
	}
	
	public void setVariances(double xVar, double yVar, double zVar){
		this.xVar = xVar;
		this.yVar = yVar;
		this.zVar = zVar;
		
	}


	public double getDistCenter() {
		return distToCenter;
	}


	public void setDistCenter(double distCenter) {
		this.distToCenter = distCenter;
	}


	public CentroidsEnum getCurrentCenter() {
		return currentCenter;
	}


	public void setCurrentCenter(CentroidsEnum currentCenter) {
		this.currentCenter = currentCenter;
	}
	
	


	
	
	
}
